
class Model:
    def _prepare_data(self, df, fields, train_valid_date):
        df_train = df.loc[:train_valid_date]

        # 用来回测的字段
        self.df_valid = df.loc[train_valid_date:]
        self.features = fields
        df_feature = df_train[fields]
        df_label = df_train['label']

        from sklearn.model_selection import train_test_split
        X_train, X_valid, y_train, y_valid = train_test_split(df_feature, df_label, test_size=0.2)
        return X_train, X_valid, y_train, y_valid

    def fit_internal(self, X_train, X_valid, y_train, y_valid):
        pass

    def fit(self, df, fields, train_valid_date, **kwargs):
        X_train, X_valid, y_train, y_valid = self._prepare_data(df, fields, train_valid_date)
        self.fit_internal(X_train, X_valid, y_train, y_valid)

    def predict(self):
        pass